-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use pointers to nested variant errors to avoid compilation errors #47
Conversation
Should fix NordSecurity#36 Definitely fixes an issue I've been having where the given test case fails with: ``` generated/errors/errors.go:1399:12: cannot use FfiConverterTypeValidationErrorINSTANCE.Read(reader) (value of type error) as ValidationError value in struct literal: need type assertion generated/errors/errors.go:1410:57: cannot use variantValue.Source (variable of type ValidationError) as *ValidationError value in argument to FfiConverterTypeValidationErrorINSTANCE.Write ``` This seems to be because the code sometimes expected `*ValidationError` and sometimes `ValidationError`. This patch makes the code use `*ValidationError` everywhere. Tests should hopefully prove they don't nil deference. Signed-off-by: Kegan Dougal <[email protected]>
435c7e3
to
2d69843
Compare
Hi and thank you for the contribution! What "unrelated" issues does this cause in particular? |
This PR as it stands is fine and suitable to be merged. I tried adding the test case in #36 and saw that it didn't actually fix that particular issue because I didn't modify
To fix this for the callback, we need to know if the enum is an error, which means calling EDIT: I can probably do something like pub fn error_type_cast(
type_: &impl AsType,
is_name_used_as_error: bool,
) I could do with some pointers on what the template should look like here. It'll be a separate PR. |
Right, I got this working by calling |
Fixes an issue I've been having where the given test case fails with:
This seems to be because the code sometimes expected
*ValidationError
and sometimesValidationError
. This patch makes the code use*ValidationError
everywhere.Tests should hopefully prove they don't nil deference.